<!--#Include File="Include.asp"--><%
'--------------------------------------
'Power By 方卡在线 @2010-2014 f02
'URL:http://www.fangka.net/
'EMail:admin@ifangka.com
'QQ:861118936
'版权所有 未经允许不得去除本版权信息
'--------------------------------------

Call CheckAdminType("0,1",UType)
Call CheckAdminLimit(ULimit,"s_AspJpeg",0)

Dim IsAspJpeg
Dim WaterMark_Text,WaterMark_Font,WaterMark_FontSize,WaterMark_FontColor,WaterMark_FontWeight,WaterMark_Pic,WaterMark_PicTransparent,WaterMark_PicGrounding,WaterMark_PointStart,WaterMark_Point_x,WaterMark_Point_y
Dim Thumb_Pic,Thumb_Pic_Width,Thumb_Pic_Height,Thumb_EditorPic,Thumb_EditorPic_Width,Thumb_EditorPic_Height

If FKFun.IsObjInstalled("Persits.Jpeg") Then
	IsAspJpeg=1
Else
	IsAspJpeg=0
End If

Types=Clng(Request.QueryString("Type"))

Select Case Types
	Case 1
		Call AspJpegBox() '图片缩略水印设置表单
	Case 2
		Call AspJpegDo() '图片缩略水印设置保存
	Case Else
		Call FKFun.ShowErr("未发现功能项！",1)
End Select

'==========================================
'函 数 名：AspJpegBox()
'作    用：图片缩略水印设置表单
'==========================================
Sub AspJpegBox()
	'水印选项
	WaterMark_Text=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_Text:","|;|","")
	WaterMark_Font=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_Font:","|;|","")
	WaterMark_FontSize=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_FontSize:","|;|","")
	WaterMark_FontColor=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_FontColor:","|;|","")
	WaterMark_FontWeight=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_FontWeight:","|;|","0")
	WaterMark_Pic=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_Pic:","|;|","")
	WaterMark_PicTransparent=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_PicTransparent:","|;|","")
	WaterMark_PicGrounding=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_PicGrounding:","|;|","")
	WaterMark_PointStart=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_PointStart:","|;|","0")
	WaterMark_Point_x=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_Point_x:","|;|","")
	WaterMark_Point_y=FKFun.GetSub(Fk_Site_WaterMarkOption,"WaterMark_Point_y:","|;|","")
	'缩略选项
	Thumb_Pic=FKFun.GetSub(Fk_Site_ThumbOption,"Thumb_Pic:","|;|","0")
	Thumb_Pic_Width=FKFun.GetSub(Fk_Site_ThumbOption,"Thumb_Pic_Width:","|;|","")
	Thumb_Pic_Height=FKFun.GetSub(Fk_Site_ThumbOption,"Thumb_Pic_Height:","|;|","")
	Thumb_EditorPic=FKFun.GetSub(Fk_Site_ThumbOption,"Thumb_EditorPic:","|;|","0")
	Thumb_EditorPic_Width=FKFun.GetSub(Fk_Site_ThumbOption,"Thumb_EditorPic_Width:","|;|","")
	Thumb_EditorPic_Height=FKFun.GetSub(Fk_Site_ThumbOption,"Thumb_EditorPic_Height:","|;|","")
%>
<form id="AspJpegSet" name="AspJpegSet" method="post" action="AspJpeg.asp?Type=2" target="ajax" boxClose="1" showStr="图片缩略水印设置成功！">
<div id="title">图片缩略水印设置</div>
<div id="box">
	<table width="95%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
<%
	If IsAspJpeg=1 Then
%>
        <tr>
            <td height="30" align="right">水印：</td>
            <td>&nbsp;<input type="radio" name="Fk_Site_WaterMark" class="input" id="Fk_Site_WaterMark" value="0"<%=FKFun.BeCheck(Fk_Site_WaterMark,0)%> onclick="$('.WaterMark').hide();" /> 关闭
				<input type="radio" name="Fk_Site_WaterMark" class="input" id="Fk_Site_WaterMark" value="1"<%=FKFun.BeCheck(Fk_Site_WaterMark,1)%> onclick="$('.WaterMark').hide();$('.WaterMark_Text').show();" /> 文字水印
				<input type="radio" name="Fk_Site_WaterMark" class="input" id="Fk_Site_WaterMark" value="2"<%=FKFun.BeCheck(Fk_Site_WaterMark,2)%> onclick="$('.WaterMark').hide();$('.WaterMark_Pic').show();" /> 图片水印<span class="help" title="<p>此功能开启时，会对所有上传的图片打水印。</p>"></span>
			</td>
        </tr>
        <tr class="WaterMark WaterMark_Text">
            <td height="30" align="right">水印文字：</td>
            <td>&nbsp;<input name="WaterMark_Text" type="text" class="input" id="WaterMark_Text" value="<%=WaterMark_Text%>" size="40" /><span class="help" title="<p>水印的文字，请输入1-50个字符（1个汉字为2个字符）。</p>"></span></td>
        </tr>
        <tr class="WaterMark WaterMark_Text">
            <td height="30" align="right">水印字体：</td>
            <td>&nbsp;<select class="input" name="WaterMark_Font" id="WaterMark_Font">
<%
		TempArr=Split("宋体||楷体_GB2312||仿宋_GB2312||黑体||隶书||幼圆||Andale Mono||Arial||Arial Black||Book Antiqua||Century Gothic||Comic Sans MS||Courier New||Georgia||Impact||Tahoma||Times New Roman||Trebuchet MS||Script MT Bold||Stencil||Verdana||Lucida Console||","||")
		For Each Temp In TempArr
%>
					<option value="<%=Temp%>"<%=FKFun.BeSelect(WaterMark_Font,Temp)%>><%=Temp%></option>
<%
		Next
%>
				</select><span class="help" title="<p>选择水印所用字体。</p>"></span>
			</td>
        </tr>
        <tr class="WaterMark WaterMark_Text">
            <td height="30" align="right">水印文字大小：</td>
            <td>&nbsp;<input name="WaterMark_FontSize" type="text" class="input" id="WaterMark_FontSize" value="<%=WaterMark_FontSize%>" /> px<span class="help" title="<p>水印的文字大小，必须是数字。</p>"></span></td>
        </tr>
        <tr class="WaterMark WaterMark_Text">
            <td height="30" align="right">水印文字颜色：</td>
            <td><div id="colorSelector"><div style="background-color:<%=WaterMark_FontColor%>"></div><input type="hidden" name="WaterMark_FontColor" id="WaterMark_FontColor" /></div></td>
        </tr>
        <tr class="WaterMark WaterMark_Text">
            <td height="30" align="right">是否粗体：</td>
            <td>&nbsp;<select name="WaterMark_FontWeight" class="input" id="WaterMark_FontWeight">
					<option value="0"<%=FKFun.BeSelect(WaterMark_FontWeight,0)%>>不加粗</option>
					<option value="1"<%=FKFun.BeSelect(WaterMark_FontWeight,1)%>>加粗</option>
				</select><span class="help" title="<p>选择水印文字是否加粗。</p>"></span>
			 </td>
        </tr>
        <tr class="WaterMark WaterMark_Pic">
            <td height="30" align="right">水印图片：</td>
            <td>&nbsp;<input name="WaterMark_Pic" type="text" class="input" id="WaterMark_Pic" size="40" value="<%=WaterMark_Pic%>" /> <input type="button" class="picList_btn btnUpload" name="btnLogo" id="btnLogo" value="上传LOGO" callback="2" inputId="WaterMark_Pic" fileAction="Upload.asp?immediate=3" /><span class="help" title="<p>水印图片，上传或者输入图片相对路径（用“/”开始）。</p>"></span>
			</td>
        </tr>
        <tr class="WaterMark WaterMark_Pic">
            <td height="30" align="right">图片透明度：</td>
            <td>&nbsp;<input name="WaterMark_PicTransparent" type="text" class="input" id="WaterMark_PicTransparent" value="<%=WaterMark_PicTransparent%>" size="5" /> %<span class="help" title="<p>水印图片透明度，请输入1-100，100为不透明。</p>"></span></td>
        </tr>
        <tr class="WaterMark WaterMark_Pic">
            <td height="30" align="right">图片底色：</td>
            <td>&nbsp;<input name="WaterMark_PicGrounding" type="text" class="input" id="WaterMark_PicGrounding" value="<%=WaterMark_PicGrounding%>" /><span class="help" title="<p>如果需要去掉底色，请输入底色的RGB值。</p>"></span></td>
        </tr>
        <tr class="WaterMark WaterMark_Text WaterMark_Pic">
            <td height="30" align="right">坐标起点：</td>
            <td>&nbsp;<select class="input" name="WaterMark_PointStart" id="WaterMark_PointStart">
					<option value="0"<%=FKFun.BeSelect(WaterMark_PointStart,0)%>>左上</option>
					<option value="1"<%=FKFun.BeSelect(WaterMark_PointStart,1)%>>左下</option>
					<option value="2"<%=FKFun.BeSelect(WaterMark_PointStart,2)%>>居中</option>
					<option value="3"<%=FKFun.BeSelect(WaterMark_PointStart,3)%>>右上</option>
					<option value="4"<%=FKFun.BeSelect(WaterMark_PointStart,4)%>>右下</option>
				</select><span class="help" title="<p>选择水印坐标起点。</p>"></span>
			 </td>
        </tr>
        <tr class="WaterMark WaterMark_Text WaterMark_Pic">
            <td height="30" align="right">坐标位置：</td>
            <td>&nbsp;X：<input name="WaterMark_Point_x" type="text" class="input" id="WaterMark_Point_x" value="<%=WaterMark_Point_x%>" size="10" />
            	&nbsp;Y：<input name="WaterMark_Point_y" type="text" class="input" id="WaterMark_Point_y" value="<%=WaterMark_Point_y%>" size="10" /><span class="help" title="<p>请输入数字。</p>"></span></td>
        </tr>
        <tr>
            <td width="18%" height="30" align="right">图片缩略：</td>
            <td width="82%">&nbsp;<input type="radio" name="Fk_Site_Thumb" class="input" id="Fk_Site_Thumb" value="0"<%=FKFun.BeCheck(Fk_Site_Thumb,0)%> onclick="$('.Thumb').hide();" /> 关闭
							<input type="radio" name="Fk_Site_Thumb" class="input" id="Fk_Site_Thumb" value="1"<%=FKFun.BeCheck(Fk_Site_Thumb,1)%> onclick="$('.Thumb').show();" /> 开启<span class="help" title="<p>选择是否开启图片缩略功能。</p>"></span>
			</td>
        </tr>
        <tr class="Thumb">
            <td width="18%" height="30" align="right">题图缩略：</td>
            <td width="82%">&nbsp;<input type="radio" name="Thumb_Pic" class="input" id="Thumb_Pic" value="0"<%=FKFun.BeCheck(Thumb_Pic,0)%> /> 关闭
							<input type="radio" name="Thumb_Pic" class="input" id="Thumb_Pic" value="1"<%=FKFun.BeCheck(Thumb_Pic,1)%> /> 开启<span class="help" title="<p>此功能开启时，会对上传的题图进行缩略，缩略会根据相应比例缩小。</p>"></span>
			</td>
        </tr>
        <tr class="Thumb">
            <td height="30" align="right">题图缩略配置：</td>
            <td>&nbsp;限宽：<input name="Thumb_Pic_Width" type="text" class="input" id="Thumb_Pic_Width" value="<%=Thumb_Pic_Width%>" size="8" /> px
            	&nbsp;限高：<input name="Thumb_Pic_Height" type="text" class="input" id="Thumb_Pic_Height" value="<%=Thumb_Pic_Height%>" size="8" /> px<span class="help" title="<p>请输入数字。</p>"></span>
			</td>
        </tr>
        <tr class="Thumb">
            <td height="30" align="right">编辑器图缩略：</td>
            <td>&nbsp;<input type="radio" name="Thumb_EditorPic" class="input" id="Thumb_EditorPic" value="0"<%=FKFun.BeCheck(Thumb_EditorPic,0)%> /> 关闭
				<input type="radio" name="Thumb_EditorPic" class="input" id="Thumb_EditorPic" value="1"<%=FKFun.BeCheck(Thumb_EditorPic,1)%> /> 开启<span class="help" title="<p>此功能开启时，会对上传的题图进行缩略，缩略会根据相应比例缩小。</p>"></span>
			</td>
        </tr>
        <tr class="Thumb">
            <td height="30" align="right">编辑器图缩略配置：</td>
            <td>&nbsp;限宽：<input name="Thumb_EditorPic_Width" type="text" class="input" id="Thumb_EditorPic_Width" value="<%=Thumb_EditorPic_Width%>" size="8" /> px
            	&nbsp;限高：<input name="Thumb_EditorPic_Height" type="text" class="input" id="Thumb_EditorPic_Height" value="<%=Thumb_EditorPic_Height%>" size="8" /> px<span class="help" title="<p>请输入数字。</p>"></span>
			</td>
        </tr>
<%
	Else
%>
        <tr>
            <td width="18%" height="30" align="right" style="color:#F00;">说明：</td>
            <td width="82%" style="color:#F00;">&nbsp;您的空间不支持ASPjpeg组件，缩略和水印功能自动关闭！</td>
        </tr>
<%
	End If
%>
	</table>
</div>
<div id="bottom">
<%
	If IsAspJpeg=1 Then
%>
	<input type="submit" class="button" name="Enter" id="Enter" value="设 置" />
<%
	End If
%>
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<script type="text/javascript">
$(document).ready(function(){
	<%If Fk_Site_WaterMark=0 Then%>
	$('.WaterMark').hide();
	<%ElseIf Fk_Site_WaterMark=1 Then%>
	$('.WaterMark').hide();
	$('.WaterMark_Text').show();
	<%ElseIf Fk_Site_WaterMark=2 Then%>
	$('.WaterMark').hide();
	$('.WaterMark_Pic').show();
	<%End If%>
	<%If Fk_Site_Thumb=0 Then%>
	$('.Thumb').hide();
	<%End If%>
	$('#colorSelector').ColorPicker({
		color: '<%=WaterMark_FontColor%>',
		onShow: function (colpkr) {
			$(colpkr).fadeIn(500);
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).fadeOut(500);
			return false;
		},
		onChange: function (hsb, hex, rgb) {
			$('#colorSelector div').css('backgroundColor', '#'+hex);
			if(hex=='000000'){
				$('#WaterMark_FontColor').val('');
			}else{
				$('#WaterMark_FontColor').val('#'+hex);
			}
		}
	});
});
</script>
<%
End Sub

'==========================================
'函 数 名：AspJpegDo()
'作    用：图片缩略水印设置保存
'==========================================
Sub AspJpegDo()
	'水印选项
	Fk_Site_WaterMark=Trim(Request.Form("Fk_Site_WaterMark"))
	WaterMark_Text=FKFun.HTMLEncode(Trim(Request.Form("WaterMark_Text")))
	WaterMark_Font=FKFun.HTMLEncode(Trim(Request.Form("WaterMark_Font")))
	WaterMark_FontSize=Trim(Request.Form("WaterMark_FontSize"))
	WaterMark_FontColor=FKFun.HTMLEncode(Trim(Request.Form("WaterMark_FontColor")))
	WaterMark_FontWeight=Trim(Request.Form("WaterMark_FontWeight"))
	WaterMark_Pic=FKFun.HTMLEncode(Trim(Request.Form("WaterMark_Pic")))
	WaterMark_PicTransparent=Trim(Request.Form("WaterMark_PicTransparent"))
	WaterMark_PicGrounding=FKFun.HTMLEncode(Trim(Request.Form("WaterMark_PicGrounding")))
	WaterMark_PointStart=Trim(Request.Form("WaterMark_PointStart"))
	WaterMark_Point_x=Trim(Request.Form("WaterMark_Point_x"))
	WaterMark_Point_y=Trim(Request.Form("WaterMark_Point_y"))
	'缩略选项
	Fk_Site_Thumb=Trim(Request.Form("Fk_Site_Thumb"))
	Thumb_Pic=Trim(Request.Form("Thumb_Pic"))
	Thumb_Pic_Width=Trim(Request.Form("Thumb_Pic_Width"))
	Thumb_Pic_Height=Trim(Request.Form("Thumb_Pic_Height"))
	Thumb_EditorPic=Trim(Request.Form("Thumb_EditorPic"))
	Thumb_EditorPic_Width=Trim(Request.Form("Thumb_EditorPic_Width"))
	Thumb_EditorPic_Height=Trim(Request.Form("Thumb_EditorPic_Height"))
	'========================================================================
	'水印选项
	Call FKFun.JsonNum(Fk_Site_WaterMark,"请选择是否启用图片水印功能！")
	Call FKFun.JsonString(WaterMark_Text,1,50,2,"请输入水印文字！","水印文字不能大于50个字符！")
	Call FKFun.JsonString(WaterMark_Font,1,50,0,"请选择水印字体！","水印字体不能大于50个字符！")
	Call FKFun.JsonNum(WaterMark_FontSize,"水印文字大小必须是数字！")
	Call FKFun.JsonString(WaterMark_FontColor,1,50,2,"请选择水印文字颜色！","水印文字颜色不能大于50个字符！")
	Call FKFun.JsonNum(WaterMark_FontWeight,"请选择水印文字是否加粗！")
	Call FKFun.JsonString(WaterMark_Pic,1,50,2,"请输入或上传水印图片！","水印图片不能大于50个字符！")
	Call FKFun.JsonNum(WaterMark_PicTransparent,"水印透明度必须是数字！")
	Call FKFun.JsonString(WaterMark_PicGrounding,1,50,2,"请输入或上传水印图片底色！","水印图片底色不能大于50个字符！")
	Call FKFun.JsonNum(WaterMark_PointStart,"请选择水印坐标起点！")
	Call FKFun.JsonNum(WaterMark_Point_x,"坐标位置X必须是数字！")
	Call FKFun.JsonNum(WaterMark_Point_y,"坐标位置Y必须是数字！")
	'缩略选项
	Call FKFun.JsonNum(Fk_Site_Thumb,"请选择是否启用图片缩略功能！")
	Call FKFun.JsonNum(Thumb_Pic,"请选择是否启用题图缩略功能！")
	Call FKFun.JsonNum(Thumb_Pic_Width,"题图缩略限宽必须是数字！")
	Call FKFun.JsonNum(Thumb_Pic_Height,"题图缩略限高必须是数字！")
	Call FKFun.JsonNum(Thumb_EditorPic,"请选择是否启用编辑器上传图片缩略功能！")
	Call FKFun.JsonNum(Thumb_EditorPic_Width,"编辑器上传图片缩略限宽必须是数字！")
	Call FKFun.JsonNum(Thumb_EditorPic_Height,"编辑器上传图片缩略限高必须是数字！")
	'========================================================================
	'水印选项
	Fk_Site_WaterMarkOption=""
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_Text:"&WaterMark_Text&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_Font:"&WaterMark_Font&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_FontSize:"&WaterMark_FontSize&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_FontColor:"&WaterMark_FontColor&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_FontWeight:"&WaterMark_FontWeight&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_Pic:"&WaterMark_Pic&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_PicTransparent:"&WaterMark_PicTransparent&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_PicGrounding:"&WaterMark_PicGrounding&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_PointStart:"&WaterMark_PointStart&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_Point_x:"&WaterMark_Point_x&"|;|"
	Fk_Site_WaterMarkOption=Fk_Site_WaterMarkOption&"WaterMark_Point_y:"&WaterMark_Point_y&"|;|"	
	'缩略选项
	Fk_Site_ThumbOption=""
	Fk_Site_ThumbOption=Fk_Site_ThumbOption&"Thumb_Pic:"&Thumb_Pic&"|;|"
	Fk_Site_ThumbOption=Fk_Site_ThumbOption&"Thumb_Pic_Width:"&Thumb_Pic_Width&"|;|"
	Fk_Site_ThumbOption=Fk_Site_ThumbOption&"Thumb_Pic_Height:"&Thumb_Pic_Height&"|;|"
	Fk_Site_ThumbOption=Fk_Site_ThumbOption&"Thumb_EditorPic:"&Thumb_EditorPic&"|;|"
	Fk_Site_ThumbOption=Fk_Site_ThumbOption&"Thumb_EditorPic_Width:"&Thumb_EditorPic_Width&"|;|"
	Fk_Site_ThumbOption=Fk_Site_ThumbOption&"Thumb_EditorPic_Height:"&Thumb_EditorPic_Height&"|;|"	
	'========================================================================
	Sqlstr="Select Top 1 * From [Fk_Site]"
	Rs.Open Sqlstr,Conn,1,3
	Application.Lock()
	If Not Rs.Eof Then
		'图片水印与缩略
		Rs("Fk_Site_WaterMark")=Fk_Site_WaterMark
		Rs("Fk_Site_WaterMarkOption")=Fk_Site_WaterMarkOption
		Rs("Fk_Site_Thumb")=Fk_Site_Thumb
		Rs("Fk_Site_ThumbOption")=Fk_Site_ThumbOption
		Rs.Update()
	End If
	Application.UnLock()
	Rs.Close
	Call FKFun.JsonSuccess()
End Sub

Call FKFun.PageEnd()
%>
